package com.kakaluote.lzhuserservice.controller;

import com.kakaluote.lzhcommon.entity.Result;
import com.kakaluote.lzhcommon.entity.ResultCode;
import com.kakaluote.lzhserverapi.auth.AuthControllerApi;
import com.kakaluote.lzhuserservice.client.UserImgClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description
 * @auther 刘中华
 * @create 2019-02-19 15:25
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class AuthController implements AuthControllerApi {



    @Resource
    UserImgClient userImgClient; //接口代理对象，由Feign生成代理对象


    @Override
    @RequestMapping("login")
    public Result login(Map loginRequest) {
        long begin = System.currentTimeMillis();
        Result userImg = userImgClient.getUserImg("1");
        System.out.println(userImg);
        long end = System.currentTimeMillis();
        // 记录访问用时：
        log.info("访问用时：{}", end - begin);
        return new Result(ResultCode.SUCCESS,"登陆成功");
    }
}
